let toastBox = (type, message, timeout, callback) => {
    if (type && message) {
        if (!timeout) {
            timeout = 1000
        }
        let cb = () => {
        };
        if (typeof timeout === 'function') {
            cb = timeout;
        }
        if (typeof callback === 'function') {
            cb = callback;
        }
        let bgcolor = '#ffffff';
        let ftcolor = '#ffffff';
        if (type === 'warning') {
            bgcolor = 'orange';
            ftcolor = '#ffffff';
        } else if (type === 'success') {
            bgcolor = 'green';
            ftcolor = '#ffffff';
        } else if (type === 'alert') {
            bgcolor = 'red';
            ftcolor = '#ffffff';
        }

        let $div = $(document.createElement('div')).css({
            position: 'fixed',
            fontSize: '12px',
            borderRadius: '10px',
            top: '50px',
            display: 'inline-block',
            padding: '5px 15px',
            left: '50%',
            transform: 'translateX(-50%)',
            textAlign: 'center',
            minWidth: '100px',
            color: ftcolor,
            fontWeight: 'bold',
            letterSpacing: '2px',
            backgroundColor: bgcolor,
        }).text(message).appendTo($('body')).fadeIn(500, () => {
            setTimeout(() => {
                $div.fadeOut(500, () => {
                    $div.remove();
                    cb();
                });
            }, timeout)
        })

    }

}
